<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:sec="http://www.springframework.org/security/facelets/tags">

<ui:composition template="/templates/principal.xhtml">
	<ui:define name="corpo">
		<div id="adm">
			<div id="cabecario">
				<div id="img_adm " style="float: left; width: 100px;">
					<h:graphicImage library="imagens" name="calendar.png" height="90" />
				</div>
				<div id="info_adm" style="width: 275px;">
					<h1>Ficha de ponto</h1>
				</div>
				<div id="user_logado">
					<span>Bem vindo :</span>#{contextoBean.usuarioLogado.nome}
				</div>

			</div>
			<div id="relogio">
				<h:graphicImage library="imagens" name="relogio.jpeg" height="300" />
			</div>

			<div id="menu">
				<h2>Menu</h2>
				<h:form prependId="false">
					<ul id="menu_adm">

						<sec:ifAllGranted roles="ROLE_ADMINISTRADOR">
							<li><h:panelGrid columns="2" cellspacing="5" cellpadding="5">
									<h:graphicImage library="imagens" name="adm.png" />
									<h:commandLink value="Área administrativa" title="Adminitrador"
										action="/admin/contratante.xhtml">
									</h:commandLink>
								</h:panelGrid>
							</li>
						</sec:ifAllGranted>

						<li><h:panelGrid columns="2" cellspacing="5" cellpadding="5">
								<h:graphicImage library="imagens" name="horas.png" />
								<a hreflang="#" id="baterponto">Bater ponto </a>
							</h:panelGrid></li>

						<li><h:panelGrid columns="2" cellspacing="5" cellpadding="5">
								<h:graphicImage library="imagens" name="atraso.png" />
								<h:commandLink action="#{contratanteBean.novoContratado}"
									value=" Bate ponto com atraso" id="atraso" />
							</h:panelGrid>
						</li>

						<li><h:panelGrid columns="2" cellspacing="5" cellpadding="5">
								<h:graphicImage library="imagens" name="sair.png" />
								<h:outputLink
									value="#{facesContext.externalContext.requestContextPath}/j_spring_security_logout">
									<h:outputText value="Logout" />
								</h:outputLink>
							</h:panelGrid>
						</li>
					</ul>
				</h:form>
			</div>


			<div class="tablehora" id="listahorafunc">
				<h:form>
					<span style="color: red; font-weight: bold; font-family: 14px;">
						<h:messages />
					</span>

					<h:dataTable value="#{pontoBean.listaPonto}" var="ponto"
						rules="rows" cellpadding="10">
						<h:column>
							<f:facet name="header">Data</f:facet>
							<h:outputText value="#{ponto.data}">
								<f:convertDateTime dateStyle="medium" />
							</h:outputText>
						</h:column>
						<h:column>
							<f:facet name="header">Hora entrada</f:facet>
							<h:outputText value="#{ponto.hora_entrada}">
								<f:convertDateTime type="time" timeStyle="medium" />
							</h:outputText>
						</h:column>
						<h:column>
							<f:facet name="header">Saída almoço</f:facet>
							<h:outputText value="#{ponto.inicio_almoco}">
								<f:convertDateTime type="time" timeStyle="medium" />
							</h:outputText>

						</h:column>
						<h:column>
							<f:facet name="header">Retorno almoço</f:facet>
							<h:outputText value="#{ponto.fim_almoco}">
								<f:convertDateTime type="time" timeStyle="medium" />
							</h:outputText>

						</h:column>
						<h:column>
							<f:facet name="header">Hora saída</f:facet>
							<h:outputText value="#{ponto.saida}">
								<f:convertDateTime type="time" timeStyle="medium" />
							</h:outputText>

						</h:column>

						<h:column>
							<f:facet name="header">detalhar</f:facet>
							<h:commandLink action="#">
								<h:graphicImage library="imagens" name="lupa.gif"
									style="border:0" />
							</h:commandLink>
						</h:column>

						<h:column>
							<f:facet name="header">Editar</f:facet>
							<h:commandLink action="#">
								<h:graphicImage library="imagens" name="editar16.png"
									style="border:0" />
							</h:commandLink>
						</h:column>

						<h:column>
							<f:facet name="header">Ecluir</f:facet>
							<h:commandLink action="#">
								<h:graphicImage library="imagens" name="excluir16.png"
									style="border:0" />
							</h:commandLink>
						</h:column>
					</h:dataTable>
				</h:form>
			</div>

			<div class="tablehora" id="registrarponto">
				<h:form prependId="false">
					<h:panelGrid columns="4">
						<h:outputLabel value="Bater ponto" styleClass="descponto" />
						<h:outputLabel value="Sair para almoço" styleClass="descponto" />
						<h:outputLabel value="Retorno  do almoço" styleClass="descponto" />
						<h:outputLabel value="Encerrar ponto" styleClass="descponto" />

						<h:commandLink action="#{pontoBean.baterPonto}">
							<h:graphicImage library="imagens" name="inicio.png" />
							<f:setPropertyActionListener target="#{pontoBean.tipoPonto}"
								value="1"></f:setPropertyActionListener>
						</h:commandLink>
						<h:commandLink action="#{pontoBean.baterPonto}">
							<h:graphicImage library="imagens" name="almoco.jpeg" />
							<f:setPropertyActionListener target="#{pontoBean.tipoPonto}"
								value="2"></f:setPropertyActionListener>
						</h:commandLink>
						<h:commandLink action="#{pontoBean.baterPonto}">
							<h:graphicImage library="imagens" name="retornoalmoco.jpeg" />
							<f:setPropertyActionListener target="#{pontoBean.tipoPonto}"
								value="3"></f:setPropertyActionListener>
						</h:commandLink>
						<h:commandLink action="#{pontoBean.baterPonto}">
							<h:graphicImage library="imagens" name="fim.png" />
							<f:setPropertyActionListener target="#{pontoBean.tipoPonto}"
								value="4"></f:setPropertyActionListener>
						</h:commandLink>
					</h:panelGrid>
				</h:form>
				<br />
					<a id="cancelaponto"   class="button_login">Cancelar</a>
			</div>
			




		</div>
	</ui:define>
</ui:composition>

</html>